import { createRouter, createWebHistory } from 'vue-router' 

import DefaultLayout from '../layouts/DefaultLayout.vue'
import Dashboard from '../views/Dashboard.vue'
import Login from '../views/Login.vue'
import Users from '../views/Users.vue'
import Products from '../views/Products.vue'
import Orders from '../views/Orders.vue'
// Remove the import for Settings

const routes = [
  {
    path: '/',
    component: DefaultLayout,
    children: [
      { path: '', name: 'Dashboard', component: Dashboard },
      { path: 'users', name: 'Users', component: Users },
      { path: 'products', name: 'Products', component: Products },
      { path: 'orders', name: 'Orders', component: Orders },
      // Remove the route for Settings
    ],
  },
  {
    path: '/login',
    name: 'Login',
    component: Login,
  },
  // Add a catch-all route
  {
    path: '/:pathMatch(.*)*',
    redirect: '/'
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
})

export default router